package com.lkd.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lkd.entity.SkuEntity;
import org.apache.ibatis.annotations.*;

/**
 * <p>
 * 商品表 Mapper 接口
 * </p>
 *
 * @author LKD
 */
@Mapper
public interface SkuDao extends BaseMapper<SkuEntity> {


   @Results(
           id="SkuResultMap",//名称
           value = {
                   @Result(column = "class_id",property = "classId"),
                   //根据商品信息中的class_id，调用com.lkd.dao.SkuClassDao.selectById方法获取结果，赋值到SkuEntity的
                   //skuClass属性中
                   @Result(column = "class_id",property = "skuClass",one = @One(select =
                   "com.lkd.dao.SkuClassDao.selectById"))
           }
   )
   @Select("select * from tb_sku where sku_id = #{id}")//先查询商品信息
    SkuEntity findById(Long id);
}
